<template>
  <NInputGroup>
    <NInputNumber :value="value" @update:value="$emit('update:value', $event)"></NInputNumber>
    <NSelect
      :options="options"
      :value="unit"
      @update:value="$emit('update:unit', $event)"
      style="width: 30%"
    ></NSelect>
  </NInputGroup>
</template>
<script setup lang="ts">
import { NInputGroup, NInputNumber, NSelect } from 'naive-ui'
const options = [
  { value: '', label: '默认(秒)' },
  { value: 's', label: '秒' },
  { value: 'm', label: '分' },
  { value: 'h', label: '小时' },
  { value: 'd', label: '天' },
  { value: 'w', label: '周' }
]

interface Duration {
  value: number
  unit?: string
}
withDefaults(defineProps<Duration>(), {
  value: 0,
  unit: ''
})
// const updateUnit = defineEmits()
</script>
